/**
 * 
 */
package com.uit.project.bustrip.factory;

import com.uit.project.bustrip.appconfig.AppsConfig;
import android.util.Log;

/**
 * @author Nguyen
 *
 */
public class BoFactory {
	public static final String TAG = "BoFactory";
	@SuppressWarnings("unchecked")
	public static <T> T instance(String entityName){
		try {
			String clazzName = AppsConfig.getBoImplPackage() + "." + entityName + "BO" + AppsConfig.IMPL;
			Class<?> clazz = Class.forName(clazzName);
			T bo = (T) clazz.newInstance(); 
			return bo;
		} catch (ClassNotFoundException e) {
			Log.e(TAG + " ClassNotFoundException", e.getMessage());
			return null;
		} catch (InstantiationException e) {
			Log.e(TAG + " InstantiationException", e.getMessage());
			return null;
		} catch (IllegalAccessException e) {
			Log.e(TAG + " IllegalAccessException", e.getMessage());
			return null;
		}
	}
}
